<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/lib/bootstrap.min.css" />
		<link rel="stylesheet" href="js/themes/default/easyui.css" />
		<script src="js/lib/jquery-1.11.0.js"></script>
		<script src="js/lib/bootstrap.min.js"></script>	
		<script src="js/base.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<style>
		body{
			font-size:12px;
		}
		table,
		th,
		td {
			border: 1px solid grey;
			border-collapse: collapse;
			padding: 5px;
			vertical-align: middle !important;
		}
		
		table td:nth-child(odd) {
			background-color: #f1f1f1;/*#e2e9ea*/
			
		}
		table td:nth-child(even) {
			
		}
		table tr:nth-child(even) {
			background-color:#ffffff;
		}
		input{
			width:280px;
		}
		span{
			width:20px;color:red;display:inline-block;text-align:center;
		}
		#sho{
			width:300px;
			height:50px;
			background:#d9534f;
			opacity:0.8;
			border-radius:8px;
			color:#fff;
			text-align: center;
			font-size:30px;
			position: absolute;
			top:0px;
			left:550px;
			display:none;
		}
	</style>
	<body>
		<div style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px">
			<table class="table table-hover">
				
				<tbody>
					<tr>
						<th colspan="8" style="font-size:25px;">修改平级奖比率：</th>
					</tr>
					<tr>
						<td>贴牌ID:</td>
						<td colspan="8" style="overflow:hidden;">
							<input class="form-control" id="d1" type="text"  style="width:280px;" />
						</td>								
					</tr>
					<tr>
						<td>平级奖比率:</td>
						<td colspan="8" style="overflow:hidden;">
							<input class="form-control" id="d2" type="text"  style="width:280px;" />
						</td>								
					</tr>						
					<tr>						
						<td colspan="8">
								<button id="query2" class="btn btn-danger" style="margin:0 auto;display:block;">点击查询</button>			
						</td>										
					</tr>
					
				</tbody>
			</table>		
		</div>
		</div>
	</body>
	<script>
		$(function(){
				var brandid = sessionStorage.getItem(key=3);
        		var brandname = sessionStorage.getItem(key=100);
        		var d1 = $('#d1').val(brandid);
			$('#d2').on('keyup',function(){
                var v = parseInt($('#d2').val()*10000);
                console.log(v);
                if(v>9){
                    $('#d2').val(0.0009)
                }
            });
            $('#d2').on('blur',function(){
                var v= $('#d2').val();
                if(v<0.0001){
                    alert('您的费率设置有误！请认真核对')
                    $('#d2').val(0.0001)
                }
            });	
			
			$("#query2").click(function(){
				var d1 = $('#d1').val();
				var d2 = $('#d2').val();
				$.ajax({
					type:"GET",
					url:window.baseUrl+"user/brand/equalRebateRate/update",
					dataType:"json",
					data:{
						equalRebateRate:d2,
						brand_id:d1
					},
					success:function(data){
						console.log("开始远程调用。。。")
						console.log(data)
						console.log(data.result)
						var msg = data.result.equalRebateRate*100;
						alert("设置平级分润比率为"+msg+"%")					
												
					},
					error:function(){
						console.log("调用失败！")
					}

				})
			})			
		})
	</script>
</html>



